<?php
if($_SERVER["PHP_SELF"] != $CONFIG['phpself'])
exit();
?>
<div class='achdiv'>
<div class='cat'>
<?php echo $ADMIN_SELECTIONCAT_TITLE[$Lang]; ?>
</div>
<br/>
<div id="partCategoryOption">
<div class="editpart">
<br/>
<center><div class = "divProgressionBarSmall"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?page=creationCat"><?php echo $CREATECAT[$Lang]; ?></a></div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" name="formSaisie">
<br/><?php echo $SELECTA[$Lang]; ?>
<select name="c">
<option value="-1">----------------SELECT------------------</option>
<?php
$resultCat = mysql_query('SELECT `id`, `name` FROM `achmw_categories`;');
while ($rowCat = mysql_fetch_assoc($resultCat))
{
$result = mysql_query('SELECT * FROM `achmw_achievements` WHERE `cat_id`='.$rowCat['id'].';');
?>
<option value="<?php echo $rowCat['id'];?>"><?php echo $rowCat['name'];?> (<?php echo mysql_num_rows($result);?>)</option>
<?php
} ?>
</select>
<br/><br/>
<script type="text/JavaScript">
	function modifierSubmit()
	{
		document.formSaisie.page.value='modifierCat';
		if(document.formSaisie.c.options[document.formSaisie.c.options.selectedIndex].value != -1)
			document.formSaisie.submit();
		else
			alert('<?php echo $ADMIN_JAVASCRIPT_ERROR_CAT[$Lang]; ?>');
	}
	function deleteSubmit()
	{
		document.formSaisie.page.value='supprimerCat';
		if(document.formSaisie.c.options[document.formSaisie.c.options.selectedIndex].value != -1)
			document.formSaisie.submit();
		else
			alert('<?php echo $ADMIN_JAVASCRIPT_ERROR_CAT[$Lang]; ?>');
	}
</script>
<table style="text-align: center; margin-left: auto; margin-right: auto; width: 100%;" border="0"
 cellpadding="2" cellspacing="2">
  <tbody>
    <tr>
      <td style="width: 300px;"><center><div class = "divModifierBarSmall"><a href="javascript:modifierSubmit();"><?php echo $MODIFIERCAT[$Lang]; ?></a></div></center></td>
      <td style="width: 300px;"><center><div class = "divDeleteBarSmall"><a href="javascript:deleteSubmit();"><?php echo $DELETECAT[$Lang]; ?></a></div></center></td>
    </tr>
  </tbody>
</table>
<input type="hidden" name="page" value=""/>
</form>
<br/><br/>
</div>
<br/><br/>
</div>
</div>